﻿#include "ssDynamicLibrary.h"

namespace StarSeeker
{

ssDynamicLibrary::ssDynamicLibrary():m_dll(0)
{}

ssDynamicLibrary::ssDynamicLibrary(const char* name):m_dll(0)
{
	Load(name);
}

ssDynamicLibrary::~ssDynamicLibrary()
{
	Unload();
}

bool ssDynamicLibrary::Load(const char* name)
{

	m_dll = LoadDLL( name );
	return m_dll != 0;
}

bool ssDynamicLibrary::Unload()
{
	if(m_dll == 0)
	{
		return false;
	}
	if( !UnloadDLL(m_dll) )
	{
		return false;
	}
	m_dll = 0;
	return true;
}

void* ssDynamicLibrary::GetFuncPtr(const char* name)
{
	if(m_dll == 0)
	{
		return 0;
	}
	return GetDLLFunction( m_dll, name );
}

}
